package com.huawei.Galenus.service.impl;

import com.huawei.Galenus.dao.AuthRepository;
import com.huawei.Galenus.domain.Auth;
import com.huawei.Galenus.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("AuthService")
public class AuthServiceImpl implements AuthService {

    @Autowired
    private AuthRepository authRepository;

    @Override
    public int save(Auth auth) {
        return authRepository.save(auth);
    }

    @Override
    public List<Auth> getMyBoughtAuth(Integer uid) {
        return authRepository.selectMyBoughtAuth(uid);
    }

    @Override
    public List<Auth> getMyAuth(String uid) {
        return authRepository.selectMyAuth(uid);
    }

    @Override
    public int approve(String aid, int status) {
        return authRepository.updateStatusById(aid, status);
    }

    @Override
    public Auth getOne(String aid) {
        return authRepository.selectById(aid);
    }
}
